<template>
  <div class="teaching_staff">
    <!--统一样式-->
    <div class="teaching_staff_title">
      <div class="teaching_staff_title_icon">
        <img src="./../../../assets/home/shiziduiwu.svg" alt="" />
      </div>
      <p class="teaching_staff_title_font">师资队伍</p>
      <div class="teaching_staff_title_more" @click="handelLessons">
        更多 <i class="el-icon-d-arrow-right"></i>
      </div>
    </div>
    <div class="teaching_staff_photograph_list">
      <div
        class="teaching_staff_photograph"
        v-for="item in teacherList"
        :key="item.id"
      >
        <div
          class="teaching_staff_photograph_img"
          @click="handleTeacher(item.id)"
        >
          <img v-if="!!item.img" :src="item.img" alt="" />
        </div>
        <p class="teaching_staff_photograph_p">{{ item.name }}</p>
      </div>
    </div>
  </div>
</template>

<script>
import { getHomeTeacherList } from "@/api/home";
export default {
  name: "teachingStaff",
  data() {
    return {
      teacherList: [],
      teacherData: {
        page: 1,
        size: 8,
      },
    };
  },
  mounted() {
    this.getHomeTeacherList();
  },
  methods: {
    getHomeTeacherList() {
      getHomeTeacherList(this.teacherData).then((response) => {
        if (response.data.code === 20000) {
          const { list } = response.data.results;
          this.teacherList = list ? list : [];
        }
      });
    },
    // 更多
    handelLessons() {
      this.$router.push({
        path: "/teacherTeam/foregoer",
        query: {
          routerName: "学科带头人",
        },
      });
    },
    handleTeacher(id) {
      this.$router.push({
        path: "/teacherTeam/foregoerDetails",
        query: {
          routerName: "",
          teacherId: id,
        },
      });
    },
  },
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.teaching_staff {
  width: 1280px;
  margin: 0 auto;
  color: #333;
  .teaching_staff_title {
    display: flex;
    padding-bottom: 15px;
    border-bottom: 2px solid #0a7b19;
    .teaching_staff_title_icon {
      width: 32px;
      height: 32px;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .teaching_staff_title_font {
      font-weight: bold;
      font-size: 24px;
      margin-left: 15px;
      width: 100px;
    }
    .teaching_staff_title_more {
      font-size: 12px;
      height: 32px;
      line-height: 32px;
      text-align: right;
      width: 1133px;
      cursor: pointer;
    }
  }
  .teaching_staff_photograph_list {
    display: flex;
    // justify-content: space-between;
    margin-top: 25px;
    margin-bottom: 25px;
    .teaching_staff_photograph {
      margin-right: 16px;
      &:last-child {
        margin: 0;
      }
      .teaching_staff_photograph_img {
        width: 146px;
        height: 184px;
        background-color: #868686;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .teaching_staff_photograph_p {
        width: 100%;
        height: 20px;
        line-height: 20px;
        text-align: center;
        margin-top: 16px;
      }
    }
  }
}
</style>
